From 44813a39b7ac91e0255849e7d33c1770fdc259a8 Mon Sep 17 00:00:00 2001 From: "emellor@leeni.uk.xensource.com" Date: Tue, 8 Nov 2005 12:00:23 +0100 Subject: [PATCH] 1. Set the UID and EUID of the process when trying to switch to a non-root user. 2. Better handle the debug-printing inside the console Signed-off-by: Dan Smith --- tools/xm-test/lib/XmTestLib/Console.py | 4 ++-- tools/xm-test/lib/XmTestLib/Test.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/xm-test/lib/XmTestLib/Console.py b/tools/xm-test/lib/XmTestLib/Console.py index 8be9235c0a..b4ef40fe57 100644 --- a/tools/xm-test/lib/XmTestLib/Console.py +++ b/tools/xm-test/lib/XmTestLib/Console.py @@ -167,6 +167,8 @@ class XmConsole: if self.consoleFd in i: try: str = os.read(self.consoleFd, 1) + if self.debugMe: + sys.stdout.write(str) bytes += 1 except: raise ConsoleError("Failed to read from console (fd=%i)" @@ -179,8 +181,6 @@ class XmConsole: % self.limit) if str == "\n": - if self.debugMe: - print "%s\n" % line if lines > 0: output += line + "\n" if saveHistory: diff --git a/tools/xm-test/lib/XmTestLib/Test.py b/tools/xm-test/lib/XmTestLib/Test.py index 02ff7e96b2..728ae12f05 100644 --- a/tools/xm-test/lib/XmTestLib/Test.py +++ b/tools/xm-test/lib/XmTestLib/Test.py @@ -125,7 +125,7 @@ def becomeNonRoot(): allusers = pwd.getpwall() for u in allusers: if u[0] == "nobody": - os.seteuid(u[2]) + os.setreuid(u[2], u[2]) break if os.geteuid() == 0: FAIL("Could not become a non-root user") -- 2.30.2